#coding:utf8
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect

def login_required(func):
    """
    登录判断装饰器
    """
    def wrapper(request, *args, **kw):
        user_obj = request.user
        if user_obj is None or user_obj.is_authenticated() == False:  # 未登录处理
            return HttpResponseRedirect(reverse('login_view'))
        else:
            return func(request, *args, **kw)
    return wrapper